//
//  AudiovisualManager.m
//  OwnerNews
//
//  Created by lanou3g on 15/8/31.
//  Copyright (c) 2015年 Drawzyn. All rights reserved.
//

#import "AudiovisualManager.h"
#import "AFNetworking.h"
#import "AvdiovisualModel.h"
#import "MBProgressHUD+MJ.h"

#define AVURL @"http://c.3g.163.com/nc/video/home/0-10.html"


@implementation AudiovisualManager


static AudiovisualManager * s_defaultManager = nil;

+ (AudiovisualManager *)defaultManager {
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        s_defaultManager = [self new];
        
        
    });
    
    return s_defaultManager;
}

-(void)GetMyAvDataAndLoadMyTableView:(void(^)())Complete {
    
    AFHTTPRequestOperationManager *AVManager = [[AFHTTPRequestOperationManager alloc]init];
    
    [AVManager GET:AVURL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
     _AvManAgerData = [[NSMutableArray alloc]initWithCapacity:30];
        
        for (NSDictionary *dict in responseObject[@"videoList"]) {
            
            AvdiovisualModel *AVModel = [AvdiovisualModel new];
            [AVModel setValuesForKeysWithDictionary:dict];
            [_AvManAgerData addObject:AVModel];
            // NSLog(@"%@",AVModel.mp4_url);
        }
       
        if (Complete) {
            Complete();
        }
        
        [MBProgressHUD showSuccess:@"刷新好了！"];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
     
    }];
    
    
}





@end
